package com.kkd.kkdapp.view;

import com.kkd.kkdapp.R;

import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.TextView;

public class CustomProgressDialog extends ProgressDialog {
	public static TextView tv1;
	public static CustomProgressDialog dialog;
	public static String msg;

	private CustomProgressDialog(Context context) {
		super(context);
	}

	public CustomProgressDialog(Context context, int theme, String m) {
		super(context, theme);
		msg = m;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.customprogressdialog);
		tv1 = (TextView) this.findViewById(R.id.textView1);
		tv1.setText(msg);
	}

	public static CustomProgressDialog show(Context context, String msg) {
		if (dialog == null) {
			dialog = new CustomProgressDialog(context, R.style.dialog, msg);
			dialog.show();
		}

		return dialog;
	}

	public void closeDialog() {
		if (dialog != null) {
			dialog.dismiss();
			dialog.cancel();
			dialog = null;
		}
	}
}